

<template>
    <div >
        <h1  style="text-align: left;">反馈列表</h1>
        <el-divider></el-divider>
        <el-table
            :data="tableData"
            style="width: 100%;text-align: center;"
            :row-class-name="tableRowClassName">
            <el-table-column

                width="100">
                <i class="el-icon-edit-outline"></i>
            </el-table-column>
            <el-table-column tyle="text-align: center"
                prop="feedback_content"
                label="内容"
                width="400"  s>

            </el-table-column>
            <el-table-column
                prop="date"
                label="日期">
            </el-table-column>
        </el-table>
        <p style="text-align: right;margin: 10px"> <el-link type="primary"@click="gofeedback()">添加反馈</el-link></p>
    </div>
</template>

<style scoped>


.el-table .warning-row {
    background: oldlace;
}

.el-table .success-row {
    background: #f0f9eb;
}
</style>
<script>
import axios from 'axios';
export default {
    methods: {
        getfeedback() {
            const userId = this.$store.getters.getuserId;
            axios.get(`/api/feed/info?user_id=${userId}`)
                .then(response => {
                    // 请求成功，处理返回的数据
                    this.tableData = response.data;
                    console.log(response.data)
                })
                .catch(error => {
                    // 请求失败，处理错误
                    console.error('Error fetching data:啊啊啊啊', error);
                });
        },
        gofeedback(){
            this.$router.push('/feedbackpage');
        }

    },
    data() {
        return {
            tableData: []
        }
    },
    mounted() {
        // 在组件挂载时调用 fetchData 方法获取数据
        this.getfeedback();
    },
}
</script>